#include <iostream>

class Teacher {
protected:
  int id;
  int salary;
  int numClass;
  int bonusPerClass;

public:
  Teacher(int id, int salary, int bonusPerClass, int numClass = 0)
      : id(id), salary(salary), bonusPerClass(bonusPerClass),
        numClass(numClass){};
  void setNumClass(int numClass) { this->numClass = numClass; }
  void addNumClass(int numClass) { this->numClass += numClass; }
  int sumSalary() { return salary + numClass * bonusPerClass; }
  virtual void display() = 0;
};

class Lecturer : public Teacher {
public:
  Lecturer(int id, int numClass = 0) : Teacher(id, 3000, 30, numClass) {};
  void display() {
      printf("讲师, id: %d, 课时: %d, 工资: %d\n", Teacher::id, Teacher::numClass, Teacher::sumSalary());
  }
};

class AssociateProfessor : public Teacher {
public:
  AssociateProfessor(int id, int numClass = 0) : Teacher(id, 4000, 40, numClass) {};
  void display() {
      printf("副教授, id: %d, 课时: %d, 工资: %d\n", Teacher::id, Teacher::numClass, Teacher::sumSalary());
  }
};

class Professor : public Teacher {
public:
  Professor(int id, int numClass = 0) : Teacher(id, 5000, 50, numClass) {};
  void display() {
      printf("教授, id: %d, 课时: %d, 工资: %d\n", Teacher::id, Teacher::numClass, Teacher::sumSalary());
  }
};

int main() {
  Lecturer lecturer = Lecturer(1);
  lecturer.addNumClass(4);
  lecturer.display();

  AssociateProfessor associateProfessor = AssociateProfessor(2, 7);
  associateProfessor.display();

  Professor professor = Professor(3, 7);
  professor.setNumClass(19);
  professor.display();
}
